<?php

namespace app\business\controller;

use app\models\{Business, PlatClass, PlatSons, Goods, GoodsSpec, Region, BusinessArea, Compent, User as Users, UserLevel, Order as Orders, OrderGoods, Coupon, Address};
use think\Db;
use think\Validate;

class User extends Base
{

    public function index()
    {
        $results = (new Users())->order(['id' => 'desc']);
        $results = $results->paginate(10, false, ['query' => $this->request->param()]);
        foreach ($results as $result) {
            $address = (new Address())->where('user_id', $result['id'])->order('is_default desc')->find() ?? [];
            $result['address'] = $address;
        }
        return view(null, [
            'list' => $results
        ]);
    }
}